#include <head.h>
#define MAX_PROCESS_CNT  (1)
int daemon_main(int argc ,char** argv)
{
    int  i=0;
    for(i=0;i<MAX_PROCESS_CNT;i++){
        pid_t pid = fork();
        if(pid == -1){
            perror("fork error");
            exit(EXIT_FAILURE);
        }
        if(pid == 0){
            break;
        }
    }
    if(i == MAX_PROCESS_CNT){
        return 0;
    }
    setsid();
    chdir("/home/Administrator");
    umask(0022);
    close(STDIN_FILENO);
    int fd  = open("dev/null",O_WRONLY);
    dup2(fd,STDOUT_FILENO);
    dup2(fd,STDERR_FILENO);
    while(1);
    return 0;
}
